package icrts.logic;

import java.awt.*;
import javax.swing.JPopupMenu;

public class SampleBuilding extends AbstractBuilding {

	Color SampleBuildingColor = Color.BLUE;
	int SampleBuildingSize = 20;
	
  public SampleBuilding(Position p) {
    super(30, p);
    this.identifier = "SampleBuilding at " + p.printPos();
   }


	public void draw(Graphics g, boolean selected){
		g.setColor(SampleBuildingColor);

		int posX = this.getPos().getX();
		int posY = this.getPos().getY();

		g.fillRect(posX, posY, SampleBuildingSize, SampleBuildingSize);

		if (selected){
			g.setColor(Color.GREEN);
			g.drawRect(posX, posY, SampleBuildingSize, SampleBuildingSize);
		}

	}
	
	protected Position findClosestFreeArea(int x, int y){
		return new Position(x,y);
	}

	// checks if the given "belongs" to / selects the game object
	public boolean selects(int x, int y){

		int posX = this.getPos().getX();
		int posY = this.getPos().getY();

		if ( (posX < x && x < posX + SampleBuildingSize) && (posY < y && y < posY + SampleBuildingSize) )
			return true;
		
		return false;
	}

	// obtains the specific JPopupMenu of this object
	public JPopupMenu getJPopupMenu(){	
		return new JPopupMenu();		
	}

}
